<?php

namespace forfun\controller;

use forfun\controller\vo\UserForm;
use forfun\service\UserService;
use restphp\http\RestHttpRequest;

/**
 * @RequestMapping ("/api/v1/users")
 */
class ApiUserController extends ApiBaseController {
    /**
     * @Post("/actions/login")
     * @return void
     */
    public function login()
    {
        $userForm = RestHttpRequest::getBody(UserForm::class, true);
        $user = UserService::getUserOrRegister($userForm);
        $this->_success($user);
    }
}